//
//      Copyright 2011 Hengda Xiao 224080
//
//      Millionare
//
//      This program is free software; you can redistribute it and/or modify
//      it under the terms of the GNU General Public License as published by
//      the Free Software Foundation; either version 2 of the License, or
//      (at your option) any later version.
//
//      This program is distributed in the hope that it will be useful,
//      but WITHOUT ANY WARRANTY; without even the implied warranty of
//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//      GNU General Public License for more details.
//
//      04.05.2011


#ifndef GAMESYSTEM_H
#define GAMESYSTEM_H



#include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include "question.h"



using std::vector;



class GameSystem
{


public:
    GameSystem(char **argv);
    ~GameSystem();

    void ImportQuestion(char **argv);//Import the question from text file
    void ClassifyQuest();//Arrange the different class level quesition to its level vector
    bool StringCheck(string str);//Check if the player input the right coomand
    void DoChoice_Quest();//Judge the choice of player input
    void GenerateQuest();//Generate a random question
    void CheckEnoughQuest();//Check if there is enough question to make a random quest list
    vector< Question* > GetRanQuest(){return random_quest;}//Get the random question vector
    bool GetQuestRdy(){return questRdy;}//check if the question are enough
    void SetQuestRdy(bool temp){questRdy = temp;}



private:
    bool questRdy;
    vector< Question* > random_quest;
    void FillQuest(int);
    int CheckQuestionTotal();

    //The following functions are crresponding the different functions
    //you can find the usage of function from their name
    void Menu_Quest();
    void AddQuest();
    void EditQuest();
    void RemoveQuest();
    void PrintAllQuest();
    void PrintByNumber();
    void PrintByLevel();
    void SaveQuest();

    void PrintGerQuest();

    vector< vector< Question* > > quest_vec;

    std::string tempStr;
    std::ifstream inFile;
    std::ofstream outFile;
    int questionTotalNum;

    void Menu_Player();


    int choice;
    bool Quit;
};

#endif // GAMESYSTEM_H
